package com.dcw.lixb.designmode.abstract_factory;

/**
 * @author lixiaobin
 * @date 2020-07-16 16:59:38
 * @desc 描述信息
 */
public class ShapeFactory implements AbsFactory {
    public static final String LINE = "line";
    public static final String TRIANGLE = "triangle";
    @Override
    public Color getColor(String color) {
        return null;
    }

    @Override
    public Shape getShape(String shape) {
        switch (shape) {
            case LINE:
                return new Line();
            case TRIANGLE:
                return new Triangle();
                default:
                    return new Shape() {
                        @Override
                        public void draw() {
                            System.out.println("draw shape unknown");
                        }
                    };
        }
    }
}
